/**
 * Created by heht on 2017/3/27.
 */
import Vue from 'vue'
import Vuex from 'vuex'
import createLogger from 'vuex/dist/logger'
import * as actions from 'store/actions'
import * as getters from 'store/getters'
Vue.use(Vuex)

const state = {
  // 提示框
  tip: {
    text: '',
    time: 2000,
    callback: null
  },
  // 加载圈圈
  loading: {
    visible: false,
    callback: null
  },
  // 是否显示公告弹窗
  showGonggao: false,
  // 是否显示登录成功金币弹窗
  showJinbi: false,
  // 是否显示规则页
  showGuize: false,
  // 存储查询用户身份的接口是否已经返回
  loginStatus: false,
  // 子比赛id
  gameId: '',
  // 团队名
  teamName: ''
}

const mutations = {
  // 提示框
  SET_TIP (state, tip) {
    state.tip = tip
  },
  // 加载圈圈
  SET_LOADING (state, loading) {
    state.loading = loading
  },
  SET_SHOW_GONGGAO (state, showGonggao) {
    state.showGonggao = showGonggao
  },
  SET_SHOW_JINBI (state, showJinbi) {
    state.showJinbi = showJinbi
  },
  SET_SHOW_GUIZE (state, showGuize) {
    state.showGuize = showGuize
  },
  SET_LOGINSTATUS (state, loginStatus) {
    state.loginStatus = loginStatus
  },
  SET_GAMEID (state, gameId) {
    state.gameId = gameId
  },
  SET_TEAMNAME (state, teamName) {
    state.teamName = teamName
  }
}

export default new Vuex.Store({
  state,
  mutations,
  actions,
  getters,
  plugins: [createLogger()]
})
